Method for reducing blocking artifacts

ABSTRACT

A method for removing blocking artifacts from moving and still pictures, comprising classifying horizontal and vertical boundaries in each picture as blocky or non-blocky; for each blocky boundary, defining an adaptive, picture content-dependent, one-dimensional filtered pixels region of interest (ROI) that crosses the boundary and is bound at each of its ends by a bounding pixel; defining a finite filter having a length correlated with the length of the ROI; defining a filtering pixels expansion that uniquely determines the padding values of the finite length filtered pixels ROI for the finite length filtering; and filtering the ROI pixels using the finite filter and the filtering expansion.

CROSS-REFERENCE TO RELATED APPLICATIONS

[0001] This application is entitled to the benefit of priority from U.S. Provisional Application No. 60/316,963 filed Sep. 5, 2001.

FIELD AND BACKGROUND OF THE INVENTION

[0002] The present invention relates to a method for reducing blocking artifacts. The invention is useful for removing blocking artifacts from still pictures or moving pictures that were reconstructed according to any coding scheme that introduce blocking artifacts. The invention provides a robust and picture-content dependent solution for removing the blocking artifact without reducing the quality or sharpness of the processed picture, and may be implemented efficiently in software and in hardware.

[0003] In Block-Based video coding (such as the ISO standards MPEG1, MPEG2, MPEG4 and JPEG, and ITU standards H.261 and H.263) each picture in the video sequence is partitioned into blocks of N×N pixels, (specifically 8×8 pixels in the MPEG/JPEG compression family and in H.263/H.261), and each block is then coded independently. When the bits-budget for the encoding is limited, a single block may be assigned with fewer bits than required for its representation (“lossy compression”). Since most popular block-based techniques are Discrete Cosine Transform (DCT) based, it is common that the deprived data is the data related to higher spatial frequency. In the extreme case of Very Low Bit rate (VLB) coding, most of the bits are allocated to the mean pixel value of the block, and only a few are allocated to the higher frequency variations. As a result, the continuity between adjacent blocks is broken. This discontinuity at the block boundaries presents an annoying artifact known as the Blocking Artifact. FIG. I illustrates the blocking problem: (A)—an original picture, and (B) a reconstructed (encoded/decoded) picture. The picture in (B) clearly shows the blocking artifact.

[0004] Existing methods to reduce this blocking artifact, as described for example in “Method of Removing Blocking Artifacts in a Coding System of a Moving Picture”, U.S. Pat. No. 6,240,135 to Kim et. al., (hereinafter “Kim '135”) is unsatisfactory. Other, equally unsatisfactory prior art methods dealing with the subject include ITU H.263 recommendation Annex J: Deblocking filter mode, U.S. Pat. No. 6,028,967, to Kim, U.S. Pat. No. 6,188,799 to Tan, U.S. Pat. No. 6,151,420 to Wober, U.S. Pat. No. 6,236,764 to Zhou, U.S. Pat. No. 6,215,425 to Andrews, U.S. Pat. No. 5,67,736 to Suzuki, U.S. Pat. No. 5,933,541 to Kutka, and U.S. Pat. No. 5,802,218 to Brailean. The Kim '135 patent, assigned to LG Electronics Inc. (hereinafter “the LG method”) is the most relevant to this disclosure, and is discussed in more detail below.

[0005] Kim '135 considers 5 pixels from each side of a block boundary. An absolute difference is then calculated between each two neighbors (9 pairs). If the absolute difference is larger than a threshold, a “0” is accumulated to a counter, while if it is smaller than the same threshold, a “1” is accumulated to the counter. The outcome is a number between 0 and 9. This is in effect a kind of an “inverse activity” measure over the boundary and into the depth of the block on each side. This inverse activity type of measure serves to decide between two methods (“modes”) of processing:

[0006] I. a Default mode (that will in effect change only the 2 boundary pixels), which is operative when the “inverse activity” is small (e.g. in case of textured data).

[0007] II. a DC mode, which is operative when the “inverse activity” is large (the area is more or less smooth, with maybe one edge inside it). In the DC mode there are two options: 1) if the difference between the minimal pixel and the maximal pixel in the region of 4 pixels to the left of the boundary and 4 pixels to the right is large (larger or equal to twice the quantization scale (QS) factor of the treated block) then nothing is done (since the algorithm deduces that the blocking artifact is not severe). However, this may be also the case when the blocking artifact is severe and there is also an edge in the 8 pixels region, so that this lack of action is actually a disadvantage. 2) if the difference is small (smaller than twice the QS factor of the treated block) then the entire region of interest (ROI) of the eight pixels is smoothed with a constant filter (since the algorithm deduces that the blocking artifact is severe).

[0008] The disadvantages of the LG method become clear when considering the following examples. In the first example (Case “A”), consider a block with a visible and solid block boundary, having a large single high edge within the block (a very common case in natural pictures divided to 8×8 blocks). In such a case, the LG method chooses the DC mode (II). Within the DC mode option 1 is chosen and no filtering is performed, i.e. the LG method will not filter the visible block boundary of this block. In another, similar example (Case “B”), consider a block in which the edge is not too high, i.e. it is a mild edge. In this case the LG method will also choose the DC mode, but in this case option 2 is chosen and filtering is performed. That is, the LG method will filter the visible block boundary of this block, but will also filter a real edge (that will affect its neighborhood since the LG method use a 9 taps filter in this case).

[0009] In a second example (Case “C”), consider a block with a visible and solid block boundary and two edges (one on each side of the boundary). In this case, the LG method will choose the Default mode (I). In the default mode, the LG method will change the value of the 2 pixels that cross the block boundary. The problem here is that the LG method is not exploiting the possibility to smooth deeper into the block, even if the edges are far away from the boundary (say at ±3 pixels from the boundary).

[0010] Yet another fault of the LG algorithm (as disclosed in the LG method) is that it is not robust to changes in the threshold against which the absolute differences are evaluated. There are no numerical values for the threshold in the prior art LG patent above (Kim '135), and the examples used above assumed the most logical values, taken from the MPEG4 standard in which the LG algorithm is presented with numerical values. If the threshold is changed to a smaller number, then Case “A” above becomes frequent, and the algorithm will produce poor results. If the threshold is changed to a larger number, then the DC mode (II) becomes irrelevant (it will not be activated). Therefore, the LG method is not robust.

[0011] There is thus a widely recognized need for, and it would be highly advantageous to have, a low cost implementation, general use, accurate de-blocking filter aimed at reducing the blocking artifact.

SUMMARY OF THE INVENTION

[0012] The present invention is of a method for reducing blocking artifacts. The method presented herein can remove blocking artifacts from pictures that were, for example, compressed using one of the compression methods mentioned above. A major advantage of the method disclosed herein is an adaptive choice of a filtered pixels region of interest (ROI). The population of pixels that undergo filtering is adaptively chosen as an integral part of the invention. The adaptation is defined in a way such that edges in the content of the picture are not smoothed out by the method, which, in essence, is a low pass filtering method due to the nature of the problem it solves. The method uniquely treats bounding conditions for finite length filtering so that no artifacts are introduced by it. It also detects areas in the picture content that are smooth, and uses an aggressive filter for better smoothing of blocking artifacts in such areas. As a result, the quality and sharpness of the picture are not reduced by applying this method to blocky pictures.

[0013] The method presented herein can be performed on a reconstructed picture, used as a post-processing operation in order to improve and enhance picture quality, or used as an in-loop operation in order to enhance image quality and improve the process of estimating motion within the compression loop.

[0014] According to the present invention there is provided a method for removing blocking artifacts from moving and still pictures, each picture composed of blocks defined by horizontal and vertical block boundaries, the method comprising the steps of: in each picture, classifying the horizontal and vertical boundaries as blocky or non-blocky; for each classified blocky boundary, defining an adaptive, picture content-dependent, one-dimensional filtered pixels region of interest (ROI) having two ends and bound at each end by a bounding pixel, the ROI including a first plurality of concatenated, adjacent pixels to be filtered, the ROI crossing the blocky boundary; defining a finite filter with a length correlated with the first plurality of concatenated, adjacent pixels of the ROI; defining a filtering pixels expansion having a second one dimensional plurality of pixels, the second plurality including the first plurality of pixels; and filtering the first plurality of pixels using the finite filter and the filtering expansion.

[0015] According to one feature of the method of the present invention, the ROI is symmetric.

[0016] According to another feature of the method of the present invention, the ROI is asymmetric.

[0017] According to the present invention, in a preferred embodiment of the method the classifying includes classifying boundaries spaced apart from each other by 8 pixels.

[0018] According to a feature in the preferred embodiment of the method of the present invention, the classifying further includes assigning the value of each pixel of a boundary pixel-duo P₈ and P₉, the boundary pixel-duo included in the first pixel plurality and straddling the block boundary, choosing a multiplier M and a receiving a quantization scale parameter QS, and classifying the block boundary as blocky if |P₈−P₉|≦(M*QS).

[0019] According to another feature in the preferred embodiment of the method of the present invention, the definition of an adaptive one-dimensional filtered pixels ROI includes: for each blocky boundary, assigning four pixel values P₅, P₆, P₇, P₈ of adjacent pixels residing on a left side for a vertical boundary and on a top side for a horizontal boundary and four pixel values P₉, P₁₀, P₁₁, P₁₂ of adjacent pixels residing on a right side for a vertical boundary and on a bottom side for a horizontal boundary, providing a threshold Threshold_(—)1, and running an iterative cycle comparing absolute value differences between each adjacent pixel pair on each side of the boundary and Threshold_(—)1.

[0020] According to yet another feature in the preferred embodiment of the method of the present invention, the comparison of absolute value differences includes, iteratively: checking if |P_(X)−P_(X−1)|≦Threshold_(—)1 wherein X is successively 8, 7 and 6 and, if true, including each P_(X−1 in) the filtered pixels ROI, the ROI bound with P₅ as a bounding pixel, else using P_(X) as the bounding pixel to bound the ROI on the left side for a vertical block boundary and on the top side for a horizontal block boundary; and checking if |P_(X)−P_(X+1)|≦Threshold_(—)1 wherein X is successively 9, 10 and 11 and, if true, including each P_(X+1) in the filtered pixels ROI, the ROI bound with P₁₂ as a bounding pixel, else using P_(X) as a right bounding pixel for a vertical block boundary and as a bottom bounding pixel for a horizontal block boundary to bound the ROI on right side for a vertical boundary and on the bottom side for a horizontal boundary.

[0021] According to yet another feature in the preferred embodiment of the method of the present invention, the definition of a finite filter further includes: if the filtered pixels ROI includes 8 pixels P₅ to P₁₂, defining the filter as Filter_(—)1 where Filter_(—)1=[h₀, h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈], and if the filtered pixels ROI includes less then 8 pixels, defining the filter as Filter_(—)2 where Filter_(—)2=[h₀, h₁, h₂, h₃, h₄].

[0022] According to yet another feature in the preferred embodiment of the method of the present invention, the definition of a filtering pixel expansion includes: receiving as input the bounding pixel of the filtered pixels ROI, the bounding pixel value obtained in the checking, receiving as input a pixel adjacent to the bounding pixel, the adjacent pixel residing outside the filtered pixels ROI, providing a threshold Threshold_(—)2, and calculating an absolute gray-level difference between the bounding pixel and the adjacent pixel, and comparing the absolute gray-level difference with Threshold_(—)2.

[0023] According to yet another feature in the preferred embodiment of the method of the present invention, the comparison of the absolute gray-level difference with Threshold_(—)2 further includes, for a vertical block boundary: checking if |P_(LB)−P_(LB−1)|≦Threshold_(—)2 where P_(LB−1) is the pixel immediately adjacently to the left of P_(LB) and P_(LB) is the left bounding pixel, and if true using the value of P_(LB−1) for the expansion, else using the value of P_(LB) for the expansion, and checking if |P_(RB)−P_(RB+1)|≦Threshold_(—)2, where P_(RB+1) is the pixel immediately adjacently to the right of P_(RB) and P_(RB) is the right bounding pixel, and if true, using the value of P_(RB+1) for the expansion, else using the value of P_(RB) for said expansion.

[0024] According to yet another feature in the preferred embodiment of the method of the present invention, the comparison of the absolute gray-level difference with Threshold_(—)2 further includes, for a horizontal block boundary: checking if |P_(TB)−P_(TB−1)|≦Threshold_(—)2 where P_(TB−1) is the pixel immediately adjacently above P_(TB) and P_(TB) is the top bounding pixel, and if true, using the value of P_(TB−1) for the expansion, else using the value of P_(TB) for the expansion, and checking if |P_(BB)−P_(BB+1)|≦Threshold_(—)2, where P_(BB+1) is the pixel immediately adjacently below P_(BB) and P_(BB) is the bottom bounding pixel, and if true, using the value of P_(BB+1) for the expansion, else using the value of P_(BB) for the expansion.

[0025] According to yet another feature in the preferred embodiment of the method of the present invention, the filtering of the filtered pixels ROI using Filter_(—)1 and the filtering pixels expansion includes: padding four values to each side of the one-dimensional filtered pixels ROI using the filtering pixels expansion values, and filtering the one-dimensional filtered pixels ROI using Filter_(—)1.

[0026] According to yet another feature in the preferred embodiment of the method of the present invention, the filtering of the filtered pixels ROI using Filter_(—)2 and the filtering pixels expansion includes: padding two values to each side of the one-dimensional filtered pixels ROI using the filtering pixels expansion values, and filtering the one-dimensional filtered pixels ROI using Filter_(—)2.

BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The invention is herein described, by way of example only, with reference to the accompanying drawings, wherein:

[0028]FIG. 1 illustrates the blocking artifact: A—an original picture, B—a reconstructed (encoded/decoded) picture;

[0029]FIG. 2 shows visualization of definitions: vertical block boundary, horizontal block boundary and boundary pixel-duo;

[0030]FIG. 3 shows a block diagram of the main conceptual stages of the suggested method for removing blocking artifacts;

[0031]FIG. 4 shows visualization of definitions: labeling of pixels of interest of the presented method over horizontal block boundaries and vertical block boundaries;

[0032]FIG. 5 shows a detailed flowchart of the conceptual stages of the suggested method for removing blocking artifacts;

[0033]FIG. 6 shows an example of the conceptual stages of the suggested method for removing blocking artifacts: A—part of a picture, B—illustration of classification stage, C—illustration of filtered pixels ROI stage, and D—illustration of filtered pixels expansion stage;

[0034]FIG. 7 shows examples for padding for a 9 taps filter: A—filtered pixels ROI with and without expansion, and B—filtered pixels ROI with expansion and padding;

[0035]FIG. 8 shows examples for padding for a 5 taps filter: A—filtered pixels ROI with and without expansion, and B—filtered pixels ROI with expansion and padding;

[0036]FIG. 9 shows examples of the performance of the suggested de-blocking method: A and C—pictures encoded at 40 KBPS/10 FPS: B and D—pictures after using the de-blocking method described herein;

DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0037] The present invention is of a method for reducing blocking artifacts. In the following description, we will refer to 8×8 pixel blocks, with the understanding that the method described is equally applicable to any N×N block based compression. The method presented herein can remove blocking artifacts from pictures that were, for example, compressed using one of the compression methods mentioned above. The method presented herein can be performed on a reconstructed picture, used as a post-processing operation in order to improve and enhance picture quality, or used as an in-loop operation in order to enhance image quality and improve the process of estimating motion within the compression loop.

[0038] The principles and operation of a method for reducing blocking artifacts according to the present invention may be better understood with reference to the drawings and the accompanying description.

[0039] Referring now to the drawings, FIG. 2 shows some of the definitions used in the following description. FIG. 2 shows a picture area 100 formed of four blocks 102, 104, 106, and 108. Each of the four blocks shown includes 64 pixels. A horizontal block boundary 110 separates top blocks 102 and 104 from bottom blocks 106 and 108. A vertical block boundary 110 separates left blocks 102 and 108 from right blocks 104 and 106. A pair of pixels residing on opposite sides of a boundary e.g. pixel pairs 114 and 116 are defined a Boundary Pixel-Duo. The method is performed on all block boundaries of a block-decoded picture, preferably first over the horizontal boundaries (i.e. from top to bottom or from bottom to top in FIG. 2), and then on the vertical boundaries (i.e. from left to right or from right to left in FIG. 2). The most preferred sequence is to operate the method first over the horizontal boundaries from top to bottom, and then over the vertical boundaries from left to right. This since decoding is commonly performed in raster scan, and quantization over the horizontal block boundaries is more severe in the general case, hence it is desired to treat it first. However, in the most general case, the operation of the method of the present invention can be performed in any sequence involving the horizontal and vertical block boundaries.

[0040] In a preferred method embodiment, the removal of a blocking artifact includes four conceptual stages as shown in a block diagram in FIG. 3, and as described below. The four stages are:

[0041] Block Boundary Classification stage 150 is a stage performed for every pixel-duo that defines a block boundary (horizontal and vertical). This stage determines for every pixel-duo in the picture whether it resides across a Blocky boundary or a Non-Blocky boundary, thus providing the decision rule for this classification. Every pixel-duo residing across a boundary classified as Blocky goes on to be treated using the next three stages. Every pixel-duo residing across a Non-blocky boundary is passed over by the next three stages, i.e. these stages are not operative in this case.

[0042] Filtered Pixels Region of Interest and Filter Definition stage 152. In this stage the region of interest (ROI) that contains the pixels that will undergo filtering (in a filtering stage 156, see below) is defined. In addition this stage also provides the method and rule for choosing and defining the actual filter that will perform the filtering in stage 156. All the pixel values that belong to the filtered pixels ROI will change after filtering stage 156 is performed. The filtered pixels ROI is a concatenated set of pixels that cross a block boundary in one dimension. The definition or choice of the pixels that will become members of the filtered pixels ROI is unique, and it is done according to a certain rule, explained below. The definition is such that the ROI will contain a blocky boundary and a smooth set of pixels on each side of the block boundary, and will not include edges. Once the filtered pixels ROI is defined, a unique rule provides a method for choosing a filter to be used in filtering stage 156. ROI definition stage 152 is performed for every pixel-duo residing across a boundary classified as blocky in stage 150.

[0043] Filtering Pixels Expansion stage 154. It is a well know fact that when a finite length one-dimensional ROI of values, and a finite length one-dimensional filter of, say, length L (where L is an odd number, and the ((L−1)/2+1)^(th) filter tap is the middle filter tap) are given, and filtering is to be performed, the filtering of the (L−1)/2 leftmost (or top-most for the vertical case) values and the filtering of the (L−1)/2 rightmost (or bottom-most for the vertical case) values must be well defined. It is common to define “padding” of (L−1)/2 values to the left (or top) and right (or bottom) of the ROI of values. This stage in the present invention provides the technique for explicitly defining the values to be used for padding the left side (or top) and right (or bottom) side of the finite one-dimensional ROI of values that was defined in stage 152. The suggested technique for explicitly defining the values to be used for padding is defined in such a way that the outcome of the filtering stage 156 provides the best visual quality for a human observer.

[0044] Filtering stage 156 is the stage in which the actual filtering of the pixels in the filtered pixels ROI (stage 152) is performed. In the filtering stage, a one-dimensional Finite Impulse Response (FIR) Low Pass Filter (LPF) is introduced to the filtered pixels ROI. Filtering pixels expansion stage 154 is used to define the padding of the finite one-dimensional filtered pixels ROI so that the outcome of the filtering will be of high visual quality. The filter used for filtering is the filter previously defined in stage 152.

[0045]FIG. 4 shows a 16×16 pixel image section. A set of pixels labeled P₄, P₅, P₆, P₇, P₈, P₉, P₁₀, P₁₁, P₁₂ and P₁₃ form a one-dimensional pixel span (of interest regarding the present invention) that cross a block boundary. In FIG. 4, a horizontal pixel span 200 crosses a vertical block boundary 202, while a vertical pixel span 204 crosses a horizontal block boundary 206. The same numbering is used for the span of pixels over a horizontal block boundary and over a vertical block boundary.

[0046]FIG. 5 shows a detailed block diagram detailing the flow of the algorithm for removing blocking artifacts, which is built around the four stages 150, 152, 154, 156, of FIG. 3.

[0047] The algorithm starts with classification stage 150 using as an input 300 the pair (boundary pixel-duo) P₈ and P₉, and two additional parameters—the QS associated with the block containing P₉, and a parameter “M”. “M” is a gain, with values typically of the order of 2 to 5, which multiplies the QS parameter. The classification criteria used in the preferred embodiment is according to: |P₈−P₉|≦M*(QS). If the condition above is true, then the block boundary associated with the specific pixel-duo P₈ and P₉ is classified as Blocky, and if the condition above is false then the block boundary associated with the specific pixel-duo P₈ and P₉ is classified as Non-Blocky.

[0048] Multiplier “M” is defined in the classification condition since the QS alone is not sufficient for a definition whether a block boundary is blocky or non-blocky. The QS alone is a direct measure for the quantization error of the mean block value, and as such it may be used only as part of the measure of blockyness. The QS is not taking into consideration higher order data like DCT basis components and their phase. By using a multiplier of a constant value, a better classification may be achieved. As a rule, all the pixels that belong to the 8×8 block boundaries (vertical and horizontal) of a reconstructed picture undergo block boundary classification stage 150.

[0049] If a specific one-dimensional block boundary is classified as Non-Blocky, no filtering is performed across it (the observation in this case is that an edge is the cause for the discontinuity between the two adjacent pixels comprising the specific pixel-duo). If a block boundary is classified as Blocky, the algorithm proceeds to stage 152 (the observation in this case is that the discontinuity between two adjacent pixels comprising the specific pixel-duo is caused by a blocking artifact).

[0050] Referring to FIG. 4, filtered pixels ROI definition stage 152 considers the span of pixels P₅, P₆, P₇ and P₈ on the left of a vertical block boundary (202) or above a horizontal block boundary (206), and the span of pixels P₉, P₁₀, P₁₁ and P₁₂ on the right of a vertical block boundary (202) or below a horizontal block boundary (206). P₅, P₆, P₇, P₈, P₉, P₁₀, P₁₁ and P₁₂ are input at an input 302 in FIG. 5.

[0051] A detailed iterative procedure for the definition of the filtered pixels ROI is now given below.

[0052] The basic operation is measuring the absolute gray-level difference of two adjacent (neighboring) pixels against a pre-determined threshold (Threshold_(—)1), input at a first threshold input 302. If the absolute gray-level difference of two adjacent pixels is smaller than or equal to Threshold_(—)1, then those two adjacent pixels are considered similar (it is an observation of this invention that such two pixels form a concatenation of two pixels both belonging to a smooth area). If the absolute gray-level difference of two adjacent pixels is larger than Threshold_(—)1, then those two adjacent pixels are considered not similar, hence implying the presence of an edge in the picture content. A typical range for Threshold_(—)1 is between 2-6, with most preferable values being 3 and 4.

[0053] The first iteration starts with the check |P₈−P₇|≦Threshold_(—)1. If true, P₇ is in the filtered pixels ROI, bounding (closing) it from the left in the case of a vertical boundary (e.g. boundary 202 in FIG. 4) and from the top in the case of a horizontal boundary (e.g. boundary 206 in FIG. 4). Else (i.e. if |P₈−P₇|>Threshold_(—)1 the filtered pixels ROI is bound (closed) on the left for boundary 202, and from the top for boundary 206 by P₈. Within this text we will refer to any of the pixels P₈ down to P₅ that close the filtered pixels ROI from the left as a “left bounding ROI pixel” or “P_(LB)”. The discussion will continue with reference to “left to right” pixel ranges crossing a vertical boundary, with the understanding that the definition of a vertical filtered pixels ROI crossing a horizontal boundary is identical. Specifically, in FIG. 4, any of pixels P₈ down to P₅ in span 204 that close the filtered pixels ROI crossing boundary 206 from the top will be a “top bounding ROI pixel” or “P_(TB)”.

[0054] If the filtered pixels ROI was not closed by P₈ (that is if P₇ was the left bounding ROI pixel of the first iteration), a next iteration is run in which the check is |P₇−P₆|≦Threshold_(—)1. If true, P₆ is in the filtered pixels ROI and is the P_(LB). Else, P₆ is not in the filtered pixels ROI, and hence P₇ is the P_(LB), and the process of defining the left boundary of the filtered pixels ROI stops.

[0055] If the filtered pixels ROI was not closed by P₇, then the next iteration checks if |P₆−P₅|≦Threshold_(—)1. If true, P₅ is in the filtered pixels ROI, the process of defining the ROI from the left ends, and the filtered pixels ROI is closed from the left side by P₅ (P₅ is the P_(LB)). Else, P₅ is not in the filtered pixels ROI and P₆ is the P_(LB).

[0056] Next, a similar iterative procedure is run on the four pixels P₉-P₁₂ across the boundary. As above, and without any loss of generality, we will deal with a horizontal span crossing a vertical boundary, the aim of this part of the procedure being to find a “right bounding ROI pixel” or “P_(RB)”, equivalent to a “bottom bounding ROI pixel” or “P_(BB)” of a vertical span crossing a horizontal boundary. Starting in a first iteration with the check |P₉-P₁₀|≦Threshold_(—)1. If true, then P₁₀ is in the filtered pixels ROI (and is the P_(RB)) and the process of defining the ROI continues. Else, P₁₀ is not in the filtered pixels ROI, the filtered pixels ROI is closed from the right side by P₉, which is the P_(RB), and the process of defining the ROI stops. Following a respective “continuation” decision, similar iterations are run with the checks |P₁₀-P₁₁|≦Threshold_(—)1 and |P₁₁-P₁₂|≦Threshold_(—)1.

[0057] It is important to note that there is no relation between the magnitude of the QS used in classification stage 150 and Threshold_(—)1 used in stage 152. In stage 152, the internal block gray-level self-similarity of the pixels is of main interest. For example, there might be an area of smooth content (or even constant content) in which self-similarity of values inside the block exists, co-existing with a large discontinuity over a block boundary that was caused by a large value of quantization in the encoding process.

[0058] It is stated as part of this invention that the iterative procedure defined above can be generalized to work with any block size, and it is not limited to 8×8 pixel blocks. A generalization is done by iterating for N/2 steps the basic rule |P_(X)−P_(X−1)|≦Threshold_(—)1, N being the size of the block, and “X” starting from the index associated with the pixels most adjacent to a block boundary. X stars from the left side for a vertical boundary, and from the top side for a horizontal boundary, in the left and top direction, A generalization is similarly done by iterating for N/2 steps the basic rule |P_(X)−P_(X+1)|≦Threshold_(—)1, N being the size of the block, and “X” starting from the index associated with the pixels most adjacent to a block boundary from the right side for a vertical boundary and from the bottom side for a horizontal boundary, in the right and bottom direction. The description below continues with reference to the special case of 8×8 pixel blocks, with the understanding that the invention as described works with general N×N blocks as well.

[0059] Once the filtered pixels ROI is decided, the algorithm, in stage 152, proceeds to define the filter that will be used in the filtering stage (156). In the preferred embodiment, the filter is chosen according to the size of the filtered pixels ROI, as explained below. The filtered pixels ROI may include in the case of 8×8 blocks: 2, 3, 4, 5, 6, 7 or 8 pixels, in one of 16 different pixels compositions (for example: P₇, P₈, P₉ and P₈, P₉, P₁₀ form two compositions of 3 pixels, P₆, P₇, P₈, P₉ and P₇, P₈, P₉, P₁₀ and P₈, P₉, P₁₀, P₁₁ form three compositions of 4 pixels, and so on). The FIR filter is preferably chosen according to the following rule: if the length of the filtered pixels ROI is exactly 8 pixels, then the filter to be used in filtering stage 156 is a 9 Taps FIR filter labeled Filter_(—)1, where Filter_(—)1=[h₀, h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈], (h₄ being the center of the filter). Typical values for Filter_(—)1 are Filter_(—)1=[1 1 2 2 4 2 2 1 1]/16, however any low pass filter having the same nature will also be suitable. If the length of the filtered pixels ROI is less than 8 pixels, then the filter to be used in filtering stage 156 is a 5 Taps FIR filter labeled Filter_(—)2, where Filter_(—)2=[h₀, h₁, h₂, h₃, h₄], (h₂ being the center of the filter). Typical values for Filter_(—)2 are Filter_(—)2=[1 1 4 1 1]/8, however any low pass filter having the same nature will also be suitable.

[0060] It is an observation of this invention that if the filtered pixels ROI is 8 pixels long, then the 8 pixels of the filtered pixels ROI belong to a smooth area in the picture. In this case a long filter will provide better smoothing of the blocking artifact, hence a filter 9 Taps long is chosen in the preferred embodiment.

[0061] Once the filtered pixels ROI and the filter to be used in the filtering stage are decided, the algorithm proceeds to stage 154—the filtering pixels expansion stage. In this stage, the values to be used for padding the left (or top) side and right (or bottom) side of the finite horizontal (or vertical) one-dimensional ROI of values are determined.

[0062] The expansion value (i.e. the value to be used for padding in filtering stage 156) is preferably determined by measuring and comparing the absolute gray-level difference of two adjacent (neighboring) pixels, of which one is a filtered pixels ROI “bounding pixel” and the other an adjacent neighbor, against a pre-determined threshold (Threshold_(—)2). Threshold_(—)2 is input at a second threshold input 304, and is typically larger by an order of magnitude than Threshold 1. In the horizontal direction (for vertical block boundaries 202) stage 152 defined the left bounding ROI pixel (P_(LB)) and the right bounding ROI pixel (P_(RB)). The expansion to the left of P_(LB) is determined according to: |P_(LB)−P_(LB−1)|≦Threshold_(—)2, where P_(LB−1) is the pixel to the left of P_(LB). If true, P_(LB−1) is the expansion pixel and the value of P_(LB−1) is used for padding in filtering stage 156. Else, P_(LB) is the expansion pixel and the value of P_(LB) is the value used for padding in filtering stage 156. The expansion to the right of P_(RB) is determined according to: |P_(RB)−P_(RB+1)|≦Threshold_(—)2, where P_(RB+1) is the pixel to the right of P_(RB). If true, P_(RB+1) is the expansion pixel and the value of P_(RB+1) is used for padding in filtering stage 156. Else, P_(RB) is the expansion pixel and the value of P_(RB) is the value used for padding in filtering stage 156.

[0063] In the vertical direction (for horizontal block boundaries 206), the expansion value is determined in a similar fashion, but replacing P_(LB) and P_(RB) with, respectively, P_(TB) and P_(BB). The padding to the top of P_(TB) is determined according to: |P_(TB)−P_(TB−1)|≦Threshold_(—)2, where P_(TB−1) is the pixel immediately above P_(TB). If true, P_(TB−1) is the expansion pixel and the value of P_(TB−1) is used for padding in filtering stage 156. Else, P_(TB) is the expansion pixel and the value of P_(TB) is the value used for padding in filtering stage 156. The padding to the bottom of P_(BB) is determined according to: |P_(BB)−P_(BB+1)|≦Threshold_(—)2, where P_(BB+1) is the pixel immediately below P_(BB). If true, P_(BB+1) is the expansion pixel and the value of P_(BB+1) is used for padding in filtering stage 156. Else, P_(BB) is the expansion pixel and the value of P_(BB) is the value used for padding in filtering stage 156. For example if P₅ was found to be a P_(LB) in stage 152, expansion stage 154 will check the value of P₅ against the value of P₄ (in this case=P_(LB−)1), specifically |P₅−P₄|≦Threshold_(—)2. If true, P₄ is the expansion (i.e. the padding value) that will be used for padding the finite filtered pixels ROI from the left side in filtering stage 156. Else, P₅ is the expansion (i.e. the padding value) that will be used for padding the finite filtered pixels ROI from the left side in filtering stage 156.

[0064] Referring now to FIG. 6, the three stages 150, 152, 154 are illustrated clearly via an example. FIG. 6A illustrates six blocks 220, 222, 224, 226, 228 and 230 of a picture 210, divided by a vertical boundary 232 and two horizontal boundaries 234 and 236. FIG. 6B illustrates classification stage 150 performed on picture 210. In B, pixels marked “X” illustrate several boundary pixel-duos (and according to FIG. 4 referred to as pixels P₈ and P₉) that were classified as Blocky across vertical block boundary 232 (i.e. P₈ and P₉ are classified as residing on each side of a blocky boundary). FIG. 6C illustrates the result of the filtered pixels ROI stage 152. For all the vertical boundaries classified as Blocky in FIG. 6B, a different filtered pixels ROI is determined according to the picture content. In FIG. 6C, eight different cases of filtered pixels ROI are presented: 250 (two symmetric sets of 8 pixels), 252 (one asymmetric set of 4 pixels to the left, i.e. P₈, P₇, P₆, P₅, and two to the right, i.e. P₉, P₁₀, of boundary 232, 254 (three asymmetric sets of 5 pixels, 4 to the left and 1 to the right of boundary 232), 256, 258, 260, 262 and 264. In 250, P₅ is the left bounding ROI pixel and P₁₂ is the right bounding ROI pixel, in 252, P₅ is the left bounding ROI pixel and P₁₀ is the right bounding ROI pixel, in 254, P₅ is the left bounding ROI pixel and P₉ is the right bounding ROI pixel. The latter five ROIs are not explained in detail, but clearly follow the explanations of the first three. All pixels marked “X” in FIG. 6C will be changed by filtering stage 156. Finally, FIG. 6D illustrates the outcome of the filtering pixels expansion stage (154) (in the figure only the expansion pixels that are not ROI bounding pixels are uniquely marked, for example pixels 270 and 272, for simpler visualization. Where not uniquely marked, the bounding pixel itself is used for padding).

[0065] The filtered pixels ROI process of stage 152 allows only similar gray-leveled pixels to join the filtered pixels ROI, hence an edge in the picture content will stop the growth of the filtered pixels ROI (which is the desired behavior in stage 152). In filtering stage 156, to which the algorithm proceeds next, a filtering process smoothes the filtered pixels ROI using a finite length low pass filter. If the edge that stopped the growth of the filtered pixels ROI is high, then the visual result after filtering is good. If the edge that stopped the growth of the filtered pixels ROI is mild (“mild” herein is considered to be more or less 25 to 45 gray-levels difference), the filtering pixels expansion stage is designed to allow mild edges to be used for padding (e.g. if Threshold_(—)2 is chosen to be of the order of the mild edges gray-levels difference, i.e. between typically 25 and 45, and most preferably between 25 and 30). This way, mild edges are slightly smoothed by the algorithm, producing good visual quality.

[0066] The filtering procedure includes two steps: padding the finite length one-dimensional filtered pixels ROI using the expansion values, and filtering the finite length filtered pixels ROI with the filter.

[0067] The padding step has two possible scenarios, depending on the length of the filter (which is an outcome of stage 152). FIG. 7 and FIG. 8 depict the two scenarios for a vertical boundary case: FIG. 7 depicts the scenario in which the 9 taps filter is used, and FIG. 8 depicts the scenario in which the 5 taps filter is used.

[0068] In FIG. 7A, the filtered pixels ROI is P₅ to P₁₂, hence the 9 Taps filter (Filter_(—)1) is used. The left side of the filtered pixels ROI was expanded by pixel P₄ (identically P_(LB−1)), so the padding in FIG. 7B is done by adding four pixels of value P₄ to the left of the filtered pixels ROI (filtering will start at P₅ since P₅ is the first pixel in the filtered pixels ROI. P₄ contributes to the filtering but it is not altered by it). The right side of the ROI was expanded by pixel P₁₂ (identically P_(RB)), in which case the padding in FIG. 7B is done by adding four pixels of value P₁₂ to the right of the filtered pixels ROI.

[0069] In FIG. 8A, the filtered pixels ROI is P₇ to P₁₂, hence the 5 Taps filter (Filter_(—)2) is used. The left side of the filtered pixels ROI was expanded by pixel P₆ (identically P_(LB−1)), so the padding in FIG. 7B is done by adding two pixels of value P₆ to the left of the filtered pixels ROI (filtering will start at P₇ since P₇ is the first pixel in the filtered pixels ROI. P₆ contributes to the filtering but it is not altered by it). The right side of the filtered pixels ROI was expanded by pixel P₁₂ (identically P_(RB)), in which case the padding in FIG. 8B is done by adding two pixels of value P₁₂ to the right of the filtered pixels ROI.

[0070] The filtering process is simply a finite length one-dimensional filtering between the finite length filter and the finite length padded filtered pixels ROI, and the result is taken only for the pixels that are the members of the filtered pixels ROI.

[0071] Finally, referring to FIG. 9 that shows an example of the performance of the suggested method for removing blocking artifacts, FIG. 9A and FIG. 9C present pictures encoded at a bit rate of 40 Kbps and a frame rate of 10 fps, in which the blocking artifact is visible. FIG. 9B and FIG. 9D present respectively the outcome of the suggested de-blocking method for the two compressed pictures.

[0072] In summary, a major innovative aspect of the method of the present invention includes the adaptive choice of filtered pixels ROI—we choose the entire population of pixels that can be smoothed without causing artifacts (like smoothing out an edge). The method works well with any number of edges in the processed picture content. Another innovative aspect is the way bounding conditions for finite length filtering are treated, as a result of the method's ability to distinguish between high and mild edges. In addition, more aggressive filtering is introduced for areas defined as smooth. As a result the quality and sharpness of the picture are not reduced by applying this method to blocky pictures.

[0073] Other advantages of the present method include:

[0074] a) making a distinct separation between strong edges and mild edges,

[0075] b) never missing a block boundary (edge in the block or not),

[0076] c) not smoothing out an edge into the data, and

[0077] d) exploiting the full width of the smooth region.

[0078] All publications, patents and patent applications mentioned in this specification are herein incorporated in their entirety by reference into the specification, to the same extent as if each individual publication, patent or patent application was specifically and individually indicated to be incorporated herein by reference. In addition, citation or identification of any reference in this application shall not be construed as an admission that such reference is available as prior art to the present invention.

[0079] While the invention has been described with respect to a limited number of embodiments, it will be appreciated that many variations, modifications and other applications of the invention may be made. 

What is claimed is:
 1. A method for removing blocking artifacts from moving and still pictures, each picture composed of blocks defined by horizontal and vertical block boundaries, the method comprising the steps of: a. in each picture, classifying the horizontal and vertical boundaries as blocky or non-blocky; b. for each said classified blocky boundary, defining an adaptive, picture content-dependent, one-dimensional filtered pixels region of interest (ROI) having two ends and bounded at each said end by a bounding pixel, said ROI including a first plurality of concatenated, adjacent pixels to be filtered, said ROI crossing said blocky boundary; c. defining a finite filter with a length correlated with said first plurality of concatenated, adjacent pixels of said ROI; d. defining a filtering pixels expansion having a second one dimensional plurality of pixels, said second plurality including said first plurality of pixels; and e. filtering said first plurality of pixels using said finite filter and said filtering pixels expansion.
 2. The method of claim 1, wherein said ROI is symmetric.
 3. The method of claim 1, wherein said ROI is asymmetric.
 4. The method of claim 1, wherein said classifying includes classifying boundaries spaced apart from each other by 8 pixels.
 5. The method of claim 4, wherein said classifying further includes: a. assigning the value of each pixel of a boundary pixel-duo P₈ and P₉, said boundary pixel-duo included in said first pixel plurality and straddling said block boundary, b. choosing a multiplier M and receiving a quantization scale parameter QS, and c. classifying said block boundary as blocky if |P₈−P₉|≦(M*QS).
 6. The method of claim 4, wherein said definition of an adaptive one-dimensional filtered pixels ROI includes: a. for each said blocky boundary, assigning four pixel values P₅, P₆, P₇, P₈ of adjacent pixels residing on a left side for a vertical block boundary and on a top side for a horizontal block boundary, and four pixel values P₉, P₁₀, P₁₁, P₁₂ of adjacent pixels residing on a right side for a vertical block boundary and on a bottom side for a horizontal block boundary, b. providing a threshold, Threshold_(—)1, and, iteratively, c. comparing absolute value differences between each said adjacent pixel pair on each side of said blocky boundary and said Threshold_(—)1.
 7. The method of claim 6, wherein said comparison of absolute value differences includes, iteratively: a. checking if |P_(X)−P_(X−1)|≦Threshold_(—)1 wherein X is successively 8, 7 and 6 and, if true, including each said P_(X−1) in said filtered pixels ROI, said ROI bound with said P₅ as said bounding pixel on said left side for a vertical block boundary and on said top side for a horizontal block boundary, else b. using said P_(X) as said bounding pixel to bound said ROI on said left side for a vertical block boundary and on said top side for a horizontal block boundary, and c. checking if |P_(X)−P_(X+1)|≦Threshold_(—)1 wherein X is successively 9, 10 and 11 and, if true, including each said P_(X+1) in said filtered pixels ROI, said ROI bound with said P₁₂ as said bounding pixel on said right side for a vertical block boundary and on said bottom side for a horizontal block boundary, else d. using said P_(X) as said bounding pixel to bound said ROI on said right side for a vertical block boundary and on said bottom side for a horizontal block boundary.
 8. The method of claim 4, wherein said definition of a finite filter further includes: a. if said filtered pixels ROI includes 8 pixels P₅ to P₁₂, defining said filter as Filter_(—)1 where Filter_(—)1=[h₀, h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈], and b. if said filtered pixels ROI includes less then 8 pixels, defining said filter as Filter_(—)2 where Filter_(—)2=[h₀, h₁, h₂, h₃, h₄].
 9. The method of claim 7, wherein said defining a filtering pixel expansion includes: a. receiving as input said bounding pixel of said filtered pixels ROI, said bounding pixel value obtained in said checking, b. receiving as input a pixel adjacent to said bounding pixel, said adjacent pixel residing outside said filtered pixels ROI, c. providing a threshold Threshold_(—)2, and d. calculating an absolute gray-level difference between said bounding pixel and said adjacent pixel, and comparing said absolute gray-level difference with said Threshold_(—)2.
 10. The method of claim 9, wherein said comparing said absolute gray-level difference with said Threshold_(—)2 further includes, for a vertical block boundary: a. checking if |P_(LB)−P_(LB−1)|≦Threshold_(—)2 where P_(LB−1) is the pixel immediately adjacently to the left of P_(LB) and P_(LB) is said left bounding pixel, and if true using the value of said P_(LB−1) for said expansion, else b. using the value of said P_(LB) for said expansion, and c. checking if |P_(RB)−P_(RB+1)|≦Threshold_(—)2, where P_(RB+1) is the pixel immediately adjacently to the right of P_(RB) and P_(RB) is said right bounding pixel, and if true, using the value of said P_(RB+1) for said expansion, else d. using the value of said P_(RB) for said expansion.
 11. The method of claim 9, wherein said comparing said absolute gray-level difference with said Threshold_(—)2 further includes, for a horizontal block boundary: a. checking if |P_(TB)−P_(TB−1)|≦Threshold_(—)2 where P_(TB−1) is the pixel immediately adjacently above P_(TB) and P_(TB) is said top bounding pixel, and if true, using the value of said P_(TB−1) for said expansion, else b. using the value of said P_(TB) for said expansion, and c. checking if |P_(BB)−P_(BB+1)|≦Threshold_(—)2, where P_(BB+1) is the pixel immediately adjacently below P_(BB) and P_(BB) is said bottom bounding pixel, and if true, using the value of said P_(BB+1) for said expansion, else d. using the value of said P_(BB) for said expansion.
 12. The method of claim 8, wherein said filtering of said filtered pixels ROI using said Filter_(—)1 and said filtering pixels expansion includes: a. padding four values to each side of said one-dimensional filtered pixels ROI using the filtering pixels expansion values, and b. filtering said one-dimensional filtered pixels ROI using said Filter_(—)1.
 13. The method of claim 8, wherein said filtering of said filtered pixels ROI using said Filter_(—)2 and said filtering pixels expansion includes: c. padding two values to each side of said one-dimensional filtered pixels ROI using said filtering pixels expansion values, and d. filtering said one-dimensional filtered pixels ROI using said Filter_(—)2. 